package com.dqy.twserver.web.controller;

import com.dqy.twserver.server.support.SupportMap;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.lang.reflect.Field;
import java.util.Map;

@RestController
public class MonitorController {
    @RequestMapping("/get/{mapName}")
    public Object getMapForName(@PathVariable("mapName") String mapName){
        try {
            Field declaredField = SupportMap.class.getDeclaredField(mapName);
            return declaredField.get(SupportMap.class);
        }catch (Exception e){
            return "error";
        }
    }
}
